var host = 'http://localhost:8080/oms/';

var _function = {
    requestUrl: function (data, url, callback) {
        var params = {};
        if (data != null && data != '') {
            for (var key in data) {
                params[key] = data[key];
            }
        }
        $.ajax({
            url: url,
            data: params,
            dataType: 'json',
            method: 'POST',
            timeout: 50000,
            success: function (res) {
                if (res.code == '10000') {
                    if (callback != null) {
                        callback(res.data);
                    }
                } else if (res.code == '4000') { // 未登录
                    window.location.href = '/pages/home/login.html';
                } else { // 出错
                    alert(res.msg);
                }
            },
            fail: function (e) {
                alert('系统出错，请联系管理员');
            }
        })
    },
    zflPushPro: function(data,callback){//推送单个产品-最福利
        this.requestUrl(data, host+'zflProduct/zflPushPro', callback);
    }

}

function getRequestParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
}

